﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Yipusoft.SecurityEvaluate;
using Yipusoft.Account.BLL;

public partial class ChangeView : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request["Flag"] == "0")
            {
                gv.Caption = "<span>人员变动查看[<a href='#' onclick='history.back(0);'>返回</a>]</span>";
            }
            else
            {
                gv.Caption = "<span>装备变动查看[<a href='#' onclick='history.back(0);'>返回</a>]</span>";

            }
            dataBind();
        }
    }

    void dataBind()
    {
        string where = Request["where"];
        List<DiaryChanges> list = Diary.DiaryChangesGetList(where);
        gv.DataSource = list;
        gv.DataBind();
    }

    protected void gvSoldiers_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label ID = (Label)e.Row.FindControl("ID");
            ID.Text = Convert.ToString((e.Row.RowIndex + 1));
            //当鼠标放上去的时候 先保存当前行的背景颜色 并给附一颜色 
            e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#F5F5F5',this.style.fontWeight='';");
            //当鼠标离开的时候 将背景颜色还原的以前的颜色 
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';");
            Label lblDeparment = e.Row.FindControl("lblDeparment") as Label;
            DiaryChanges change = e.Row.DataItem as DiaryChanges;
            lblDeparment.Text = Department.GetDepartment(change.DepartmentID).FullName;
        }
    }
}
